<div id=all_todo_list class='card' style="display:<%=(@act == "new" ? "none":"on")%>">
<div class=page_head>
  <span class="float_right">
    <b><%="Filter by user".t%>:</b>
    <select name='user_id' id='user_id' onchange="document.location=($('user_id').selectedIndex == 0 ? '/projects/<%=@project.id%>/todos' : '/projects/<%=@project.id%>/todos?uid=' + $('user_id').options[$('user_id').selectedIndex].value)">
     <option>-<%="All user".t%>-</option>
     <%=options_from_collection_for_select @project.users,"id","name",params[:uid].to_i%>
     <option value="00" <%=(params[:uid].to_s == "00" ? "selected" : "")%>>-<%="Any user".t%>-</option>
    </select>
  </span>
  <h2><%="To do list".t%></h2>
</div>
<%if @todos.size == 0%>
 <div class=tour>
  <%#if (not @project.use_permission  or @project.use_permission.nil?) or (@project.use_permission and @cur_user.has_permission?("prj_" + @project.id.to_s + "_todo_new"))%>
  <%if @cur_user.have_power?(@project)%>
   <h2><%=link_to "Post the first todos for this project".t,"#",:onclick=>"Element.hide('all_todo_list');Element.show('new_todo')"%></h2>
   <%end%>
   <%="Make lists, add items, and check them off. Get things done with to-do lists.".t%>
 </div>
 <%=feature'todo'%>
<%end%>
<div style="margin-top:-15px">
<% for todo in @todos %>
 <div class=todo_list id='todo_set_<%=todo.id%>'>
 <span class="private_label float_right"><%="Private".t if todo.private%></span>
  <h2><%=link_to todo.name,"#",:onmouseover=>"Element.show('todo_#{todo.id}')",:onmouseout=>"Element.hide('todo_#{todo.id}')"%> 
   <%if todo.milestone%>
   <span class=intro_txt>[<%="Milestone".t%> - <%=todo.milestone.name%>(<%=todo.milestone.started_at.strftime("%Y/%m/%d")%> - <%=todo.milestone.due_at.strftime("%Y/%m/%d")%>)]</span>
   <%end%>
  </h2>
  <li id=todo_<%=todo.id%> class=todo_action style="display:none" onmouseover="Element.show('todo_<%=todo.id%>')" onmouseout="Element.hide('todo_<%=todo.id%>')">
<%if (@project.use_permission and (@cur_user.have_power?(@project) or @cur_user.has_permission?("prj_" + @project.id.to_s + "_todo_edit"))) or (not @project.use_permission or @project.use_permission.nil?)%>
    <%=link_to image_tag("trash.gif",:border=>0), project_todo_path(todo.project,todo), :confirm => 'Are you sure?', :method => :delete%>
    <%=link_to_remote 'Edit'.t,:url=>{:action=>'edit_it',:id=>todo.id},:update=>'todo_set_' + todo.id.to_s,:loading=>"Element.show('indicator_#{todo.id}');Element.hide('todo_#{todo.id}')",:complet=>"Element.hide('indicator_#{todo.id}"%>
  <%end%>
  </li>
  <li id=indicator_<%=todo.id%> class=indicator style="display:none">
    <%=image_tag "indicator.gif"%>
  </li>
 </div>
  <span class=todo_body><%=h todo.body %></span>
  <div id='todo_item_list_<%=todo.id%>' class="todo_item_list"> 
    <%=render :partial=>'todo_item_list',:locals=>{:todo_items => todo.todo_items} if (not @project.use_permission  or @project.use_permission.nil?) or (@project.use_permission and @cur_user.has_permission?("prj_" + @project.id.to_s + "_todo_view"))%>
  </div>

  <div id='add_todo_item_suite_<%=todo.id%>'>
   <%=render :partial=>'add_todo_item_suite',:locals=>{:todo=>todo}%>
  </div> <!--add_todo_item_suite-->

  <div id='finished_todo_item_list_<%=todo.id%>' class="finished_todo_item_list"> 
   <%=render :partial=>'finished_todo_item_list',:locals=>{:todo_items => todo.finished_todo_items} if (not @project.use_permission  or @project.use_permission.nil?) or (@project.use_permission and @cur_user.has_permission?("prj_" + @project.id.to_s + "_todo_view"))%>
  </div>
<% end %>
</div>
</div>

<div id=new_todo style="display:<%=(@act == "new"? "on":"none")%>" class='card'> 
<div class=page_head>
  <h2><%="New to-do list".t%></h2>
</div>
<% form_for(:todo, :url => project_todos_path) do |f| %>
    <%=render :partial=>'form',:locals=>{:f=>f,:project_id=>@project.id}%>
    <%=indicator('sub')%>
    <%= submit_tag "Create this list".t,:id=>'sub_todo',:onclick=>"Element.show('indicator_sub')" %> 
    <%="or".t%> <%=link_to "Cancel".t,"#",:class=>'admin',:onclick=>"Element.toggle('new_todo');Element.toggle('all_todo_list')"%>
<% end %>
</div>
